import bus from '@/bus'
const onSetColor = (data) => {
  let color = 'red'
  if (Number(data) < 0) color = 'green'
  return { style: { color: color } }
}
const data = {
  pageData: {
    current: 1,
    size: 20,
    data: [],
    distributor: '',
    total: '',
    status: 'pass',
    reportCycleList: [],
    columns: [{
      title: '经销商',
      key: 'subjectName',
      align: 'left',
      minWidth: 200
    }, {
      title: '门店类型',
      key: 'storeTypeName',
      align: 'left',
      minWidth: 150
    }, {
      title: '周期',
      key: 'name',
      align: 'left',
      minWidth: 200,
      render: (h, p) => {
        let text = p.row.beginDate + '~' +p.row.endDate
        return h('div', text)
      }
    }, {
      title: '门店数量',
      key: 'storeCount',
      align: 'right',
      minWidth: 100
    }, {
      title: '巡店数量',
      key: 'inspectionStoreCount',
      align: 'right',
      minWidth: 100
    }, {
      title: '操作',
      key: 'name',
      align: 'right',
      minWidth: 120,
      render: (h, p) => {
        return h('div', [
          h('Button', {
            props: {
              type: 'primary',
              size: 'small'
            },
            on: {
              click () {
                bus.$emit('onDetailed', {row: p.row})
              }
            }
          }, '明细')
        ])
      }
    }],
    form: {
      distributorId: '',
      officeId: '',
      departmentId: '',
      cycle: '',
      beginYearMonth: '',
      endYearMonth: '',
      storeTypeId: ''
    }
  },
  pageData1: {
    current: 1,
    size: 20,
    data: [],
    total: '',
    status: 'pass',
    reportCycleList1: [],
    isCompleteList: [{
      status: 'true',
      name: '已巡店'
    }, {
      status: 'false',
      name: '未巡店'
    }],
    columns: [{
      title: '经销商',
      key: 'distributorName',
      align: 'left',
      minWidth: 200
    }, {
      title: '门店类型',
      key: 'storeTypeName',
      align: 'left',
      minWidth: 150
    }, {
      title: '周期',
      key: 'name',
      align: 'left',
      minWidth: 150,
      render: (h, p) => {
        let text = p.row.beginYearMonth + '~' + p.row.endYearMonth
        return h('div', text)
      }
    }, {
      title: '门店名称',
      key: 'storeName',
      align: 'left',
      minWidth: 200
    }, {
      title: '门店维护人',
      key: 'storeMaintainerName',
      align: 'left',
      minWidth: 150
    }, {
      title: '巡店状态',
      key: 'name',
      align: 'left',
      minWidth: 150,
      render: (h, p) => {
        let status = p.row.isComplete ? '已巡店' : '未巡店'
        return h('div', status)
      }
    }, {
      title: '操作',
      key: 'name',
      align: 'right',
      minWidth: 120,
      render: (h, p) => {
        let btn = h('div', [
          h('Button', {
            props: {
              type: 'primary',
              size: 'small'
            },
            on: {
              click() {
                bus.$emit("onDetail", { item: p.row })
              }
            }
          }, '详情')
        ])
        if (p.row.isComplete) return btn
      }
    }],
    form: {
      cycle: '',
      storeName: '',
      isComplete: '',
      storeMaintainerName: '',
      storeTypeId: '',
      beginYearMonth: '',
      endYearMonth: '',
      distributorId: ''
    }
  }
}
export default data
